﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Microsoft.Practices.Unity;

using EventBrokR;

namespace ERPStore.Start
{
	public class EventBrokerConfig
	{
		public static void Register(Microsoft.Practices.Unity.IUnityContainer container)
		{
			container.RegisterType<EventBrokR.IPublisher, EventBrokR.Publisher>(new ContainerControlledLifetimeManager());

			var eb = container.Resolve<EventBrokR.IPublisher>();
			EventBrokR.GlobalConfiguration.Configuration.DependencyResolver = new IOC.EventBrokRDependencyResolver(container);

			// Global Event Consumer
			eb.Container.Register<EventConsumers.AppStartEventConsumer>();
			eb.Container.Register<EventConsumers.AppStopEventConsumer>();
		}
	}
}
